<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html;charset=utf-8" %>
<html style="height: 100%">
<head>
    <meta charset="UTF-8">
    <title>Insert title here</title>

    <style type="text/css">
        * {
            box-sizing: border-box;
            padding: 0;
            margin: 0;
        }

        div {
            width: 100%;
            height: 100%;
            background-color: white;
            padding-left: 1%;
        }

        #d1 {
            width: 90%;
            height: 5%;
            position: relative;
            background-color: white;
            font-family: "宋体";
            font-size: 14px;
            padding-top: 1%;
            padding-left: 1%;
            padding-right: 1%;
        }

        #d1-1 {
            width: 30%;
            height: 100%;

            float: left;
        }

        #d1-2 {
            width: 4%;
            height: 120%;
            background-color: #009688;
            float: right;
            margin-top: -0.5%;
        }

        #d2 {
            width: 90%;
            height: 10%;
            position: relative;
            background-color: #EEEEEE;
            padding-top: 1%;
            padding-left: 1%;
        }

        #d2-1 {
            width: 9%;
            height: 70%;
            float: left;
            background-color: red;
            padding-top: 0.5%;
            padding-left: 1%;
        }

        #d2-2 {
            width: 9%;
            height: 70%;
            float: left;
            background-color: green;
            margin-left: 1%;
            padding-top: 0.5%;
            padding-left: 1%;
        }

        #d3 {
            width: 90%;
            height: 80%;
            position: relative;
            margin-top: 1%;
        }

        table {
            border-collapse: collapse;
            line-height: 30px;
            width: 100%;
            height: 80%;
            text-align: center;
        }

        a {
            text-decoration: none;
            color: black;
        }

        #d5 {
            margin-top: -28%;
            margin-left: 40%;
            width: 25%;
            height: 30%;
            position: absolute;
            padding-left: 0;
            display: none;

        }

        #d6 {
            width: 100%;
            height: 16%;

            /* margin-top:10%; */
            position: relative;
            padding-left: 0;
            /* padding-top: 2.3%; */
        }

        #d6-1 {
            width: 50%;
            height: 100%;
            float: left;
            background-color: #EEEEEE;
            padding-left: 32%;
            padding-top: 3%;
        }

        #d6-2 {
            width: 50%;
            height: 100%;
            float: right;
            background-color: #EEEEEE;
            padding-left: 33%;
            padding-top: 3%;
        }

        #d7 {
            width: 95%;
            height: 40%;
            position: relative;
            padding-top: 8%;
            font-family: "宋体";
            font-size: 18px;
            padding-left: 15%;


        }

        #d8 {
            width: 100%;
            height: 40%;
            position: relative;


        }

        #d8-1 {
            width: 22%;
            height: 40%;
            position: absolute;
            background-color: #009688;
            padding-top: 2%;
            text-align: center;
            background-color: #009688;
            margin-top: 10%;
            margin-left: 40%;

        }

        #d8-2 {
            width: 22%;
            height: 40%;
            position: absolute;
            margin-left: 70%;
            margin-top: 10%;
            border: 1px solid black;
            padding-top: 2%;
            text-align: center;

        }

        #d5 a {
            text-decoration: none;
            color: black;
        }
    </style>
</head>
<body style="height: 100%">
<div>
    <div id="d1">

        <div id="d1-1">首页/演示/导航元素</div>
        <div id="d1-2">
            <a href="/activityQueryAll">
                <img src=".././image/update.png" width="20px" height="20px">
            </a>
        </div>
    </div>
    <hr width="90%" color="gray">
    <div id="d2">
        <div id="d2-1">
            <img src=".././image/delete2.png" width="20px" height="20px">
            <a href="#" id="delete">批量删除</a>
        </div>
        <div id="d2-2">
            <a href="./serve/apartmentAdd.html" target="i">
                <img src=".././image/add.png" width="20px" height="20px">添加
            </a>
        </div>
    </div>
    <div id="d3">
        <table border="1">
            <tr>
                <td width="5%">
                    <input type="checkbox" value="" id="one">
                </td>
                <td>活动编号</td>
                <td>活动主题</td>
                <td>活动地址</td>
                <td>活动成本</td>
                <td>组织者</td>
                <td>占用时间</td>
                <td width="9%">操作</td>
            </tr>

            <form action="/activityDeleteBatches" method="post">

                <c:forEach items="${list}" var="user">

                    <tr>
                        <td><input type="checkbox" value="${user.a_id}" name="key" class="two"></td>
                        <td id="ten">${user.a_id}</td>
                        <td>${user.a_subject}</td>
                        <td>${user.a_site}</td>
                        <td>${user.a_cost}</td>
                        <td>${user.a_organizer}</td>
                        <td>${user.a_taketime}</td>
                        <td>
                            <a href="activityQuery?id=${user.a_id}" target="i">
                                <img src=".././image/update2.png" width="20px" height="20px">
                            </a>&nbsp;
                            <a href="activityUpdate?id=${user.a_id}" target="i">
                                <img src=".././image/edit-2.png" width="20px" height="20px">
                            </a>&nbsp;
                            <a href="/activityDelete?id=${user.a_id}">
                                <img src="../image/delete2.png" width="20px" height="20px" onclick="return five()">
                            </a>
                        </td>
                    </tr>

                </c:forEach>

                <input id="dosth" type="submit" style="display: none">

            </form>
        </table>
    </div>
    <div id="d5">
        <div id="d6">
            <div id="d6-1">信息</div>
            <div id="d6-2">
                <a href="apartment.jsp" target="i">
                    <img src="../image/close.png" width="20px" height="20px">
                </a>
            </div>
        </div>
        <div id="d7">确定要删除吗?</div>
        <div id="d8">
            <div id="d8-1">
                <a href="/activityDelete">确定</a>
            </div>
            <div id="d8-2"><a href="/activityQueryAll">取消</a></div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var dodelete = document.getElementById("delete");

    dodelete.onclick = function () {

        var dosth = document.getElementById("dosth");

        dosth.click()
    }

    var one = document.getElementById("one");

    var two = document.getElementsByClassName("two");

    one.onclick = function () {
        for (let i = 0; i < two.length; i++) {
            two[i].checked = one.checked;
        }
    }

    function five() {
        var ten = document.getElementById("ten");

        var b = confirm("确定要删除吗");
        if (b) {
            return true;
        } else {
            location.href = "/activityQueryAll";
        }
    }
</script>
</div>
</body>
</html>